<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../../vue.js"></script>
</head>
<style>
  .denglu {
    background-color: coral;
  }

  .zhuce {
    background-color: darkcyan;
  }
</style>

<body>
  <div id="app">
    <h1>{{msg}}</h1>
    <button @click="isLoagin=true">登录</button> <button @click="isLoagin=false">注册</button>
    <form action="###" class="denglu" v-if="isLoagin" key="loagin">
      <p>登录</p>
      <input type="text">
      <input type="text">
    </form>
    <form action="###" class="zhuce" v-else>
      <p>注册</p>
      <input type="text">
      <input type="text">
    </form>
  </div>
  <script>
    Vue.config.productionTip = false;
    const vm = new Vue({
      el: "#app",
      data() {
        return {
          msg: "hello vue!",
          isLoagin: true
        }
      },
      methods: {}
    })
  </script>
</body>

</html>